<?php
/**
 * User: onwer
 * Date: 11-12-28
 * Time: 上午12:02
 */

require 'lib/lib.php';
include 'islogin.php';

$actinfo='';
$include_src='';
$f_title='';
$act=isset($_GET['act'])?$_GET['act']:'';
$table=new Table();

switch ($act){
    case 'add':{
        if(isset($_POST['tname']) && isset($_POST['tdesc'])){
            if($table->add($_POST['tname'],$_POST['tdesc'])){
                $actinfo=Fun::echoinfo('创建成功！','succeed');
            }else{
                $actinfo=Fun::echoinfo($table->errorinfo[2],'error');
            }
        }
        $include_src='table_add.php';
        break;
    }

    case 'del':{
        if(isset($_GET['tid'])&&isset($_GET['confirm'])&&$_GET['confirm']==='yes'){
            if($table->del($_GET['tid'])){
                $actinfo=Fun::echoinfo('删除成功！','succeed');
            }else{
                $actinfo=Fun::echoinfo($table->errorinfo[2],'error');
            }
        }
        $include_src='table_del.php';
        break;
    }
    default:{
        $include_src='table_add.php';
    }
}

include ADMIN_ABS_TPL_SRC.'index.php';